package com.zw.goods.controller;


import com.zw.commons.log.annotation.Log;
import com.zw.commons.log.enums.BusinessType;
import com.zw.goods.service.GoodStockService;
import com.zw.object.goods.GoodStock;
import com.zw.object.result.Result;
import com.zw.object.vo.GoodStockVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 物资出入库表 前端控制器
 * </p>
 *
 * @author zw
 * @since 2023-03-15
 */
@RestController
@Api(tags = "物资出入库")
@RequestMapping("/goods/good-stock")
public class GoodStockController {

    @Autowired
    private GoodStockService goodStockService;

    @ApiOperation("获取全部物资出入库信息")
    @PostMapping("/list")
    @Log(title = "获取全部物资出入库信息",businessType = BusinessType.INSERT)
    public Result lsit(@Validated @RequestBody GoodStockVo vo){
        return goodStockService.list(vo);
    }

    @ApiOperation("物资出入库信息保存")
    @Log(title = "物资出入库信息保存",businessType = BusinessType.INSERT)
    @PostMapping("/save")
    public Result save(@Validated @RequestBody GoodStock goodStock, HttpServletRequest request){
        return goodStockService.save(goodStock,request);
    }

}

